home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1996 July: Mac OS SDK / Dev.CD Jul 96 SDK / Dev.CD Jul 96 SDK1.toast / Development Kits (Disc 1) / OpenDoc Development Framework / ODFDev / Draw / Sources / ShpTrakr.h < prev    next >
Encoding:
Text File  |  1996-04-25  |  3.9 KB  |  145 lines  |  [TEXT/MPS ]

  1. //========================================================================================
  2. //
  3. //    File:                ShpTrakr.h
  4. //    Release Version:    $ ODF 1 $
  5. //
  6. //    Author:                Henri Lamiraux
  7. //
  8. //    Copyright:            (c) 1993 - 1996 by Apple Computer, Inc., all rights reserved.
  9. //
  10. //========================================================================================
  11.  
  12. #ifndef SHPTRAKR_H
  13. #define SHPTRAKR_H
  14.  
  15. // ----- Part Layer -----
  16.  
  17. #ifndef FWTRACKR_H
  18. #include "FWTrackr.h"
  19. #endif
  20.  
  21. // ----- OS Layer -----
  22.  
  23. #ifndef FWRECT_H
  24. #include "FWRect.h"
  25. #endif
  26.  
  27. #ifndef FWINK_H
  28. #include "FWInk.h"
  29. #endif
  30.  
  31. #ifndef FWSTYLE_H
  32. #include "FWStyle.h"
  33. #endif
  34.  
  35. //========================================================================================
  36. //    Forward class declarations
  37. //========================================================================================
  38.  
  39. class CBaseShape;
  40. class FW_CScroller;
  41.  
  42. //========================================================================================
  43. //    class CShapeTracker
  44. //========================================================================================
  45.  
  46. class CShapeTracker : public FW_CTracker
  47. {
  48. //----------------------------------------------------------------------------------------
  49. //    Constructor/Destructor
  50. //
  51. public:
  52.     CShapeTracker(Environment* ev, 
  53.                 FW_CView* view, 
  54.                 ODFacet* facet, 
  55.                 CBaseShape* theShape, 
  56.                 FW_Boolean gridOn);
  57.     virtual ~CShapeTracker();
  58.  
  59. //----------------------------------------------------------------------------------------
  60. //    Inherited API
  61. //
  62. public:
  63.     virtual FW_CPoint     BeginTracking(Environment* ev, 
  64.                                 const FW_CPoint& anchorPoint);
  65.     virtual FW_CPoint     ContinueTracking(Environment* ev, 
  66.                                 const FW_CPoint& anchorPoint, 
  67.                                 const FW_CPoint& previousPoint, 
  68.                                 const FW_CPoint& currentPoint);
  69.     virtual FW_Boolean    EndTracking(Environment* ev, 
  70.                                 const FW_CPoint& anchorPoint, 
  71.                                 const FW_CPoint& lastPoint);
  72.         
  73. //----------------------------------------------------------------------------------------
  74. //    New API
  75. //
  76. protected:
  77.     void            ForceToGrid(Environment* ev, FW_CPoint& point);
  78.     
  79. //----------------------------------------------------------------------------------------
  80. //    Data Members
  81. //
  82. private:
  83.     CBaseShape*     fShape;
  84.     FW_Boolean         fErase;
  85.     FW_Boolean        fGridOn;
  86.     FW_CScroller*    fScroller;
  87. };
  88.  
  89. //========================================================================================
  90. //    class CResizeTracker
  91. //========================================================================================
  92.  
  93. class CResizeTracker : public FW_CTracker
  94. {
  95. //----------------------------------------------------------------------------------------
  96. //    Constructor/Destructor
  97. //
  98. public:
  99.     CResizeTracker(Environment* ev, 
  100.                     FW_CView* view, ODFacet* facet,
  101.                     CBaseShape* theShape, short whichHandle,
  102.                     const FW_CInk& resizeInk, const FW_CStyle& resizeStyle,
  103.                     FW_Boolean gridOn);
  104.     virtual ~CResizeTracker();
  105.  
  106. //----------------------------------------------------------------------------------------
  107. //    Inherited API
  108. //
  109. public:
  110.     virtual FW_CPoint     BeginTracking(Environment* ev, 
  111.                             const FW_CPoint& anchorPoint);
  112.     virtual FW_CPoint     ContinueTracking(Environment* ev, 
  113.                             const FW_CPoint& anchorPoint, 
  114.                             const FW_CPoint& previousPoint, 
  115.                             const FW_CPoint& currentPoint);
  116.     virtual FW_Boolean    EndTracking(Environment* ev, 
  117.                             const FW_CPoint& anchorPoint, 
  118.                             const FW_CPoint& lastPoint);
  119.  
  120. //----------------------------------------------------------------------------------------
  121. //    New API
  122. //
  123. public:
  124.     void        GetLastLocation(FW_CPoint& lastLocation)
  125.                     {lastLocation = fLastLocation;}
  126.     
  127. private:
  128.     void        ForceToGrid(Environment* ev, FW_CPoint& point);
  129.     
  130. //----------------------------------------------------------------------------------------
  131. //    Data Members
  132. //
  133. private:
  134.     CBaseShape*     fShape;
  135.     short            fWhichHandle;
  136.     FW_Boolean         fErase;
  137.     FW_CInk            fResizeInk;
  138.     FW_CStyle        fResizeStyle;
  139.     FW_CPoint        fDelta;
  140.     FW_Boolean        fGridOn;
  141.     FW_CPoint        fLastLocation;
  142.     FW_CScroller*    fScroller;
  143. };
  144.  
  145. #endif